<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>tinyOS: tMutex.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">tinyOS
   &#160;<span id="projectnumber">v1.00</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('t_mutex_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">tMutex.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="t_mutex_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#ifndef TMUTEX_H</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#define TMUTEX_H</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;</div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#include &quot;tConfig.h&quot;</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#if !defined(TINYOS_ENABLE_MUTEX) || TINYOS_ENABLE_MUTEX == 1</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="t_event_8h.html">tEvent.h</a>&quot;</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment">// 互斥信号量类型</span></div><div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="struct__t_mutex.html">   24</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__t_mutex.html">_tMutex</a> {</div><div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="struct__t_mutex.html#a8b516ab130f86e4b15ca025c98c3dc53">   25</a></span>&#160;    <a class="code" href="struct__t_event.html">tEvent</a> <a class="code" href="struct__t_mutex.html#a8b516ab130f86e4b15ca025c98c3dc53">event</a>;                   </div><div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="struct__t_mutex.html#a16598f387191bb413e5c802b23e501ef">   27</a></span>&#160;    uint32_t <a class="code" href="struct__t_mutex.html#a16598f387191bb413e5c802b23e501ef">lockedCount</a>;           </div><div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="struct__t_mutex.html#af99fea13bfba6d0a457c2779fa8ecc5a">   28</a></span>&#160;    <a class="code" href="struct__t_task.html">tTask</a> *<a class="code" href="struct__t_mutex.html#af99fea13bfba6d0a457c2779fa8ecc5a">owner</a>;                   </div><div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="struct__t_mutex.html#aa1d8803bb70576a417cba7092640ebd3">   29</a></span>&#160;    uint32_t <a class="code" href="struct__t_mutex.html#aa1d8803bb70576a417cba7092640ebd3">ownerOriginalPrio</a>;     </div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;} <a class="code" href="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#gaa6112cfb92458b1b8a76c4a0ed988469">tMutex</a>;</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="comment">// 互斥信号量查询结构</span></div><div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="struct__t_mutex_info.html">   33</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__t_mutex_info.html">_tMutexInfo</a> {</div><div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="struct__t_mutex_info.html#a80462c64b9184115aa568f08227f7f4a">   34</a></span>&#160;    uint32_t <a class="code" href="struct__t_mutex_info.html#a80462c64b9184115aa568f08227f7f4a">taskCount</a>;             </div><div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="struct__t_mutex_info.html#a2ad329dc18ddf3afd170e73535c5907a">   36</a></span>&#160;    uint32_t <a class="code" href="struct__t_mutex_info.html#a2ad329dc18ddf3afd170e73535c5907a">ownerPrio</a>;             </div><div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="struct__t_mutex_info.html#ad2ca878c1d7b4012ae3954a79aa664ef">   37</a></span>&#160;    uint32_t <a class="code" href="struct__t_mutex_info.html#ad2ca878c1d7b4012ae3954a79aa664ef">inheritedPrio</a>;         </div><div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="struct__t_mutex_info.html#af99fea13bfba6d0a457c2779fa8ecc5a">   39</a></span>&#160;    <a class="code" href="struct__t_task.html">tTask</a> *<a class="code" href="struct__t_mutex_info.html#af99fea13bfba6d0a457c2779fa8ecc5a">owner</a>;                   </div><div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="struct__t_mutex_info.html#a16598f387191bb413e5c802b23e501ef">   40</a></span>&#160;    uint32_t <a class="code" href="struct__t_mutex_info.html#a16598f387191bb413e5c802b23e501ef">lockedCount</a>;           </div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;} <a class="code" href="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga8ad2a424a8470cc1b822de9d62b71d81">tMutexInfo</a>;</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#gae12a3d5db0c3834e8a3837358f4f3302">tMutexInit</a> (<a class="code" href="struct__t_mutex.html">tMutex</a> *mutex);</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;uint32_t <a class="code" href="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga2608713c70ae2de620f39566c023abe9">tMutexWait</a> (<a class="code" href="struct__t_mutex.html">tMutex</a> *mutex, uint32_t waitTicks);</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;uint32_t <a class="code" href="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga26ec3e3848541464c9ba38de67875e11">tMutexNoWaitGet</a> (<a class="code" href="struct__t_mutex.html">tMutex</a> *mutex);</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;uint32_t <a class="code" href="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#gad192db653abe0e792860dccd9e4050ba">tMutexNotify</a> (<a class="code" href="struct__t_mutex.html">tMutex</a> *mutex);</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;uint32_t <a class="code" href="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga8e1b65bea50a87032971eb167d411723">tMutexDestroy</a> (<a class="code" href="struct__t_mutex.html">tMutex</a> *mutex);</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga01ba0fbff6eaeae119c26db5573f358a">tMutexGetInfo</a> (<a class="code" href="struct__t_mutex.html">tMutex</a> *mutex, <a class="code" href="struct__t_mutex_info.html">tMutexInfo</a> *info);</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;<span class="preprocessor">#endif // TINYOS_ENABLE_MUTEX</span></div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* TMUTEX_H */</span><span class="preprocessor"></span></div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div><div class="ttc" id="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F_html_ga01ba0fbff6eaeae119c26db5573f358a"><div class="ttname"><a href="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga01ba0fbff6eaeae119c26db5573f358a">tMutexGetInfo</a></div><div class="ttdeci">void tMutexGetInfo(tMutex *mutex, tMutexInfo *info)</div><div class="ttdef"><b>Definition:</b> <a href="t_mutex_8c_source.html#l00218">tMutex.c:218</a></div></div>
<div class="ttc" id="struct__t_task_html"><div class="ttname"><a href="struct__t_task.html">_tTask</a></div><div class="ttdef"><b>Definition:</b> <a href="t_task_8h_source.html#l00031">tTask.h:31</a></div></div>
<div class="ttc" id="struct__t_mutex_info_html_ad2ca878c1d7b4012ae3954a79aa664ef"><div class="ttname"><a href="struct__t_mutex_info.html#ad2ca878c1d7b4012ae3954a79aa664ef">_tMutexInfo::inheritedPrio</a></div><div class="ttdeci">uint32_t inheritedPrio</div><div class="ttdef"><b>Definition:</b> <a href="t_mutex_8h_source.html#l00037">tMutex.h:37</a></div></div>
<div class="ttc" id="struct__t_mutex_info_html_a80462c64b9184115aa568f08227f7f4a"><div class="ttname"><a href="struct__t_mutex_info.html#a80462c64b9184115aa568f08227f7f4a">_tMutexInfo::taskCount</a></div><div class="ttdeci">uint32_t taskCount</div><div class="ttdef"><b>Definition:</b> <a href="t_mutex_8h_source.html#l00034">tMutex.h:34</a></div></div>
<div class="ttc" id="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F_html_gad192db653abe0e792860dccd9e4050ba"><div class="ttname"><a href="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#gad192db653abe0e792860dccd9e4050ba">tMutexNotify</a></div><div class="ttdeci">uint32_t tMutexNotify(tMutex *mutex)</div><div class="ttdef"><b>Definition:</b> <a href="t_mutex_8c_source.html#l00122">tMutex.c:122</a></div></div>
<div class="ttc" id="struct__t_mutex_html_aa1d8803bb70576a417cba7092640ebd3"><div class="ttname"><a href="struct__t_mutex.html#aa1d8803bb70576a417cba7092640ebd3">_tMutex::ownerOriginalPrio</a></div><div class="ttdeci">uint32_t ownerOriginalPrio</div><div class="ttdef"><b>Definition:</b> <a href="t_mutex_8h_source.html#l00029">tMutex.h:29</a></div></div>
<div class="ttc" id="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F_html_ga2608713c70ae2de620f39566c023abe9"><div class="ttname"><a href="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga2608713c70ae2de620f39566c023abe9">tMutexWait</a></div><div class="ttdeci">uint32_t tMutexWait(tMutex *mutex, uint32_t waitTicks)</div><div class="ttdef"><b>Definition:</b> <a href="t_mutex_8c_source.html#l00037">tMutex.c:37</a></div></div>
<div class="ttc" id="t_event_8h_html"><div class="ttname"><a href="t_event_8h.html">tEvent.h</a></div></div>
<div class="ttc" id="struct__t_mutex_html_af99fea13bfba6d0a457c2779fa8ecc5a"><div class="ttname"><a href="struct__t_mutex.html#af99fea13bfba6d0a457c2779fa8ecc5a">_tMutex::owner</a></div><div class="ttdeci">tTask * owner</div><div class="ttdef"><b>Definition:</b> <a href="t_mutex_8h_source.html#l00028">tMutex.h:28</a></div></div>
<div class="ttc" id="struct__t_mutex_info_html_a16598f387191bb413e5c802b23e501ef"><div class="ttname"><a href="struct__t_mutex_info.html#a16598f387191bb413e5c802b23e501ef">_tMutexInfo::lockedCount</a></div><div class="ttdeci">uint32_t lockedCount</div><div class="ttdef"><b>Definition:</b> <a href="t_mutex_8h_source.html#l00040">tMutex.h:40</a></div></div>
<div class="ttc" id="struct__t_mutex_info_html_a2ad329dc18ddf3afd170e73535c5907a"><div class="ttname"><a href="struct__t_mutex_info.html#a2ad329dc18ddf3afd170e73535c5907a">_tMutexInfo::ownerPrio</a></div><div class="ttdeci">uint32_t ownerPrio</div><div class="ttdef"><b>Definition:</b> <a href="t_mutex_8h_source.html#l00036">tMutex.h:36</a></div></div>
<div class="ttc" id="struct__t_event_html"><div class="ttname"><a href="struct__t_event.html">_tEvent</a></div><div class="ttdef"><b>Definition:</b> <a href="t_event_8h_source.html#l00032">tEvent.h:32</a></div></div>
<div class="ttc" id="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F_html_gaa6112cfb92458b1b8a76c4a0ed988469"><div class="ttname"><a href="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#gaa6112cfb92458b1b8a76c4a0ed988469">tMutex</a></div><div class="ttdeci">struct _tMutex tMutex</div></div>
<div class="ttc" id="struct__t_mutex_html_a8b516ab130f86e4b15ca025c98c3dc53"><div class="ttname"><a href="struct__t_mutex.html#a8b516ab130f86e4b15ca025c98c3dc53">_tMutex::event</a></div><div class="ttdeci">tEvent event</div><div class="ttdef"><b>Definition:</b> <a href="t_mutex_8h_source.html#l00025">tMutex.h:25</a></div></div>
<div class="ttc" id="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F_html_ga8e1b65bea50a87032971eb167d411723"><div class="ttname"><a href="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga8e1b65bea50a87032971eb167d411723">tMutexDestroy</a></div><div class="ttdeci">uint32_t tMutexDestroy(tMutex *mutex)</div><div class="ttdef"><b>Definition:</b> <a href="t_mutex_8c_source.html#l00180">tMutex.c:180</a></div></div>
<div class="ttc" id="struct__t_mutex_info_html_af99fea13bfba6d0a457c2779fa8ecc5a"><div class="ttname"><a href="struct__t_mutex_info.html#af99fea13bfba6d0a457c2779fa8ecc5a">_tMutexInfo::owner</a></div><div class="ttdeci">tTask * owner</div><div class="ttdef"><b>Definition:</b> <a href="t_mutex_8h_source.html#l00039">tMutex.h:39</a></div></div>
<div class="ttc" id="struct__t_mutex_html_a16598f387191bb413e5c802b23e501ef"><div class="ttname"><a href="struct__t_mutex.html#a16598f387191bb413e5c802b23e501ef">_tMutex::lockedCount</a></div><div class="ttdeci">uint32_t lockedCount</div><div class="ttdef"><b>Definition:</b> <a href="t_mutex_8h_source.html#l00027">tMutex.h:27</a></div></div>
<div class="ttc" id="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F_html_gae12a3d5db0c3834e8a3837358f4f3302"><div class="ttname"><a href="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#gae12a3d5db0c3834e8a3837358f4f3302">tMutexInit</a></div><div class="ttdeci">void tMutexInit(tMutex *mutex)</div><div class="ttdef"><b>Definition:</b> <a href="t_mutex_8c_source.html#l00023">tMutex.c:23</a></div></div>
<div class="ttc" id="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F_html_ga26ec3e3848541464c9ba38de67875e11"><div class="ttname"><a href="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga26ec3e3848541464c9ba38de67875e11">tMutexNoWaitGet</a></div><div class="ttdeci">uint32_t tMutexNoWaitGet(tMutex *mutex)</div><div class="ttdef"><b>Definition:</b> <a href="t_mutex_8c_source.html#l00091">tMutex.c:91</a></div></div>
<div class="ttc" id="struct__t_mutex_info_html"><div class="ttname"><a href="struct__t_mutex_info.html">_tMutexInfo</a></div><div class="ttdef"><b>Definition:</b> <a href="t_mutex_8h_source.html#l00033">tMutex.h:33</a></div></div>
<div class="ttc" id="struct__t_mutex_html"><div class="ttname"><a href="struct__t_mutex.html">_tMutex</a></div><div class="ttdef"><b>Definition:</b> <a href="t_mutex_8h_source.html#l00024">tMutex.h:24</a></div></div>
<div class="ttc" id="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F_html_ga8ad2a424a8470cc1b822de9d62b71d81"><div class="ttname"><a href="group___xE4_xBA_x92_xE6_x96_xA5_xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga8ad2a424a8470cc1b822de9d62b71d81">tMutexInfo</a></div><div class="ttdeci">struct _tMutexInfo tMutexInfo</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="t_mutex_8h.html">tMutex.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
